package tt.dz.order.pojo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import tt.dz.order.dao.BaseDAOUtil;

/**
 * 订单分润修改日志
 * 
 * @author NIBO
 *
 */
public class OrderItemDividedDetailChangeLogInfo extends OrderItemDividedDetail {

	private static final  String SELECT_ALL_SQL="select service.name as serviceName,changeId,orderNo, divided.serviceNo, serviceProvider, isCost, receiver, currentRatio, totalPrice, splitedPrice, minGuarantee, divided.createTime from orderitem_divided_detail_change_log divided INNER JOIN order_service_info service ON service.serviceno=divided.serviceno ";
	private String changeId;

	private String serviceName;


	public String getChangeId() {
		return changeId;
	}


	public void setChangeId(String changeId) {
		this.changeId = changeId;
	}


	public String getServiceName() {
		return serviceName;
	}


	public void setServiceName(String serviceName) {
		this.serviceName = serviceName;
	}

	@Override
	public void save(){
		String sql = "insert into orderitem_divided_detail_change_log(changeId,orderNo, serviceNo, serviceProvider, isCost, receiver, currentRatio, totalPrice, splitedPrice, minGuarantee, createTime) values(:changeId,:orderNo, :serviceNo, :serviceProvider, :isCost, :receiver, :currentRatio, :totalPrice, :splitedPrice, :minGuarantee, :createTime)";
		BaseDAOUtil.updateObject(sql, this);
	}
	public static List<OrderItemDividedDetailChangeLogInfo> queryByChangeId(String changeId) {
		String sql=SELECT_ALL_SQL+" where changeId = :changeId";
		Map<String, Object> paramMap = new HashMap<String, Object>();
		paramMap.put("changeId", changeId);
		return BaseDAOUtil.queryForList(sql, paramMap, OrderItemDividedDetailChangeLogInfo.class);
	}
}
